<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>原型链</title>
</head>
<body>
  <script>
      function Person(name,age){
        this.name = name;
        this.age = age;
      }
      var name="张三";
      Person.prototype.say = function(){
        alert("大家好，我是"+this.name);
      }
    // 写个Student 构造函数继承 Person所有方法
    // 继承构造函数，继承原型
    function Student(name,age,no){
      Person.call(this,name,age); //01 继承构造函数
      this.no = no;
    }
    // 02 继承原型
    Student.prototype = Object.create(Person.prototype);
    Student.prototype.study = function(){alert("学号"+this.no+"正在努力学习")}
    // 修改构造函数
    Student.prototype.constructor = Student;

    var s = new Student("小张",22,9527);
    // s instanceof Student  ,s instanceof Person  ,s instanceof Object true
    
  </script>
</body>
</html>